﻿<%@ Page Title="Cungmuanao.com - Quản Lý giới thiệu" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="ManagePartnerCats.aspx.cs" Inherits="Admin_ManagePartnerCats" %>
<%@ Import Namespace="DTO" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="title">Quản lý lỉnh vực đối tác</div>
    <div class="body">
<asp:GridView runat="server" ID="gvwPartCats" Width="100%" 
        AutoGenerateColumns="False" DataSourceID="objAllPartnerCats" DataKeyNames="ID"
        AllowPaging="True" EmptyDataText="<b>Chưa có giới thiệu nào</b>"
        onrowcreated="gvwPartCats_RowCreated" 
        onrowdeleted="gvwPartCats_RowDeleted" 
        onselectedindexchanged="gvwPartCats_SelectedIndexChanged">
    <Columns>
         <asp:TemplateField HeaderText="STT" >
            <ItemStyle HorizontalAlign="Center" Width="20" />
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>' />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Tiêu đề">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblTitle" Text='<%#Eval("Title")  %>'  />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Ghi chú">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblimportance" Text='<%#Eval("Description")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:CommandField HeaderText="Edit" ButtonType="Image" SelectImageUrl="~/Images/edit.gif"
                SelectText="Edit" ShowSelectButton="True">
                <ItemStyle HorizontalAlign="Center" Width="20" />
        </asp:CommandField>
        
        <asp:CommandField HeaderText="Delete" ButtonType="Image" DeleteImageUrl="~/Images/delete.gif"
                DeleteText="Delete" ShowDeleteButton="True">
                <ItemStyle HorizontalAlign="Center" Width="20" />
            </asp:CommandField>
    </Columns>
 </asp:GridView>
 <asp:ObjectDataSource runat="server" ID="objAllPartnerCats" TypeName="BLL.Pages.PartnerCats" 
            DeleteMethod="DeletePartnerCats" SelectMethod="ListPartnerCat">
     <DeleteParameters>
         <asp:Parameter Name="id" Type="Int32"  />
     </DeleteParameters>
 </asp:ObjectDataSource>
 
<p></p>

<asp:DetailsView runat="server" ID="dvwCurrPartCat" DefaultMode="Insert"
        AutoGenerateRows="False" DataKeyNames="ID" Width="100%" 
            AutoGenerateInsertButton="True" AutoGenerateEditButton="True" 
    DataSourceID="objCurrPartnerCat" onitemcommand="dvwCurrPartCat_ItemCommand" 
        oniteminserted="dvwCurrPartCat_ItemInserted" 
        onitemupdated="dvwCurrPartCat_ItemUpdated">
    <Fields>
        <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="true" InsertVisible="false"
               SortExpression="ID" />
         <asp:BoundField DataField="AddedDate" HeaderText="Ngày t&#7841;o" InsertVisible="False"
            ReadOnly="True" SortExpression="AddedDate" />
         <asp:BoundField DataField="AddedBy" HeaderText="Ng&#432;&#7901;i t&#7841;o" InsertVisible="False" ReadOnly="True"
            SortExpression="AddedBy" />                
        <asp:TemplateField HeaderText="Tiêu đề">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtName" Text='<%#Bind("Title") %>' Width="99%" />
                <asp:RequiredFieldValidator ID="valRequireName" runat="server" ControlToValidate="txtName" SetFocusOnError="true"
                  Text="Bắt buộc nhập tiêu đề" ToolTip="Bắt buộc nhập tiêu đề" Display="Dynamic"></asp:RequiredFieldValidator>
            </EditItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Mức độ">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtNumber" Text='<%#Bind("Importance") %>' Width="99%" />
            </EditItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Ghi chú">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtDescription" Text='<%#Bind("Description") %>' Width="99%" />
            </EditItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Hình ảnh">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtImageUrl" Text='<%#Bind("ImageUrl") %>' Width="99%" />
            </EditItemTemplate>
        </asp:TemplateField> 
    </Fields>
    </asp:DetailsView>
    
    <asp:ObjectDataSource runat="server" ID="objCurrPartnerCat" 
            TypeName="BLL.Pages.PartnerCats" SelectMethod="GetPartnerCatByID" 
    InsertMethod="InsertPartnerCats" UpdateMethod="UpdatePartnerCats">
        <SelectParameters>
            <asp:ControlParameter PropertyName="SelectedValue" ControlID="gvwPartCats" 
                Type="Int32" Name="PartnerCatsID" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="importance" Type="Int32" />
            <asp:Parameter Name="description" Type="String" />
            <asp:Parameter Name="imageUrl" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="id" Type="Int32" />
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="importance" Type="Int32" />
            <asp:Parameter Name="description" Type="String" />
            <asp:Parameter Name="imageUrl" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    </div>
    <div class="bottom"></div>
</asp:Content>

